import 'gs_localizations.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

/*
 * @desc 本地化多语言代表
 *
 */

class GSLocalizationsDelegate  extends LocalizationsDelegate<GSLocalizations>{

  GSLocalizationsDelegate();

  ///支持中文和英语
  @override
  bool isSupported(Locale locale) {
    return true;
  }

  ///根据locale，创建一个对象用于提供当前locale下的文本显示
  @override
  Future<GSLocalizations> load(Locale locale) {
    return new SynchronousFuture<GSLocalizations>( GSLocalizations(locale));
  }

  ///应该重新装载
  @override
  bool shouldReload(LocalizationsDelegate<GSLocalizations> old) {
    return false;
  }

  ///全局静态的代理(需要在localizationsDelegates初始化)
  static GSLocalizationsDelegate delegate =  GSLocalizationsDelegate();

}